package cn.com.dycc.sys_manage.t_class.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.dycc.common.controller.BaseController;
import cn.com.dycc.sys_manage.t_class.entity.ClassEntity;
import cn.com.dycc.sys_manage.t_class.param.ClassParam;
import cn.com.dycc.sys_manage.t_class.param.FindListClassParam;
import cn.com.dycc.sys_manage.t_class.service.ClassService;
import cn.com.dycc.util.JsonObjectResult;

@Controller
@RequestMapping("clas")
public class ClassController extends BaseController{
	
	@Resource(name="classService")
	private ClassService classService;
	
	//增加职务信息
	@RequestMapping("add.do")
	@ResponseBody
	public JsonObjectResult addClass(HttpServletRequest request,ClassParam classParam){
		String mes = classService.addClass(request, classParam);
		return new JsonObjectResult(mes);
	}
	
	//查询所有的职务信息
	@RequestMapping("find.do")
	@ResponseBody
	public JsonObjectResult findClassAll(HttpServletRequest request,FindListClassParam findListClassParam){
		List<ClassEntity> list = classService.findClassAll(request, findListClassParam);
		String count = classService.findClassAllCount(request, findListClassParam);
		return new JsonObjectResult(count,list);
	}
	
	//更新职务信息
	@RequestMapping("update.do")
	@ResponseBody
	public JsonObjectResult updateClass(HttpServletRequest request,ClassParam classParam){
		String mes = classService.updateClass(request, classParam);
		return new JsonObjectResult(mes);
	}
	
	//删除职务
	@RequestMapping("delclass.do")
	@ResponseBody
	public JsonObjectResult delClass(HttpServletRequest request,String id){
		String mes = classService.delClass(request, id);
		return new JsonObjectResult(mes);
	}
}
